import React, { Component } from 'react'
import qs from 'querystring' 

const DetailDate =[
    {id:'01',content:'你好，中国！'},
    {id:'02',content:'你好，地球！'},
    {id:'03',content:'你好，银河系！'},
]

export default class Detail extends Component {
    render() {
        console.log(this.props)
        const {search} = this.props.location
        const {id,title} = qs.parse(search.slice(1))
        const dindResult = DetailDate.find((obj)=>{
            return obj.id === id
        })
        return (
            <ul>
                <li>id:{id}</li>
                <li>title:{title}</li>
                <li>content:{dindResult.content}</li>
            </ul>
        )
    }
}
